home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /*
- * pspatch -
- * Make calibration patches.
- *
- * Paul Haeberli - 1990
- */
- #include "stdio.h"
-
- main(argc,argv)
- int argc;
- char **argv;
- {
- if (argc<2)
- bwscale();
- else
- cmykscale();
- }
-
- cmykscale()
- {
- int i, j, g;
- float fg;
-
- beginps(stdout,8.5/11.0,0.0,72*8.5,0.0,72*11.0);
- pssetfont("Times-Roman",10.0);
- pstranslate(36.0,36.0);
- pslinewidth(0.5);
- printf("/oneblock {\n");
- psgsave();
- printf("translate ");
- psrectf(0.0,0.0,24.0,24.0);
- psgrey(0.0);
- psrect(0.0,0.0,24.0,24.0);
- psmoveto(-1.0,-10.0);
- printf("show\n");
- psgrestore();
- printf("} bind def\n\n");
-
- psgsave();
- pstranslate(36.0,40.0);
- for(j=0; j<5; j++) {
- for(i=0; i<=32; i++) {
- g = i*8;
- if(g>255)
- g = 255;
- fg = g/255.0;
- switch(j) {
- case 0:
- printf("(cyn %d) ",g);
- pscmyk(fg,0.0,0.0,0.0);
- break;
- case 1:
- printf("(mag %d) ",g);
- pscmyk(0.0,fg,0.0,0.0);
- break;
- case 2:
- printf("(yel %d) ",g);
- pscmyk(0.0,0.0,fg,0.0);
- break;
- case 3:
- printf("(blk %d) ",g);
- pscmyk(0.0,0.0,0.0,fg);
- break;
- case 4:
- printf("(rgbg %d) ",g);
- psrgb(fg,fg,fg);
- break;
- }
- if(i>=16)
- printf("%f %f\n",2*40.0*j+40.0,40.0*(i-16));
- else
- printf("%f %f\n",2*40.0*j,40.0*i);
- printf("oneblock\n");
- }
- }
- pscmyk(1.0,1.0,1.0,1.0);
- pstranslate(2*40.0*5,40.0*8);
- psrectf(0.0,0.0,24.0,24.0);
- psgrey(0.0);
- psrect(0.0,0.0,24.0,24.0);
- psmoveto(0.0,-8.0);
- psgrestore();
- endps();
- }
-
- bwscale()
- {
- int i, x, y;
-
- beginps(stdout,8.5/11.0,0.0,72*8.5,0.0,72*11.0);
- pssetfont("Times-Roman",10.0);
- pstranslate(36.0,36.0);
- pslinewidth(0.5);
- printf("/bwblock {\n");
- psgsave();
- printf("translate\n");
- printf("setgray\n");
- psrectf(0.0,0.0,24.0,24.0);
- printf("0.0 setgray\n");
- psrect(0.0,0.0,24.0,24.0);
- psmoveto(0.0,-8.0);
- printf("show\n",i);
- psgrestore();
- printf("} bind def\n");
- for(i=0; i<256; i++) {
- x = i%16;
- y = i/16;
- printf("(%d) ",i);
- printf("%f ",1.00*i/255.0);
- printf("%f %f ",24.0*x,40.0*y);
- printf("bwblock\n");
- }
- endps();
- }
-